1. /* sdfasinh.cpp by K.Tsuru */
  2. // function ID 3310 DRADIX
  3. /***************************************************************
  4. SDouble class
  5. inverse hyperbolic function arsinh(x)(area sinh)
  6. [Definition]
  7. r = sqrt(x*x+1)
  8. x > 0 : arsinh(x)= log(r + x)
  9. x < 0 : arsinh(x)= -log(r - x)
  10. If |x| is much less than one,the addition x to r(very close to one)
  11. causes a loss of trailing digits.Then a formula
  12. arsinh x = artanh( x/sqrt(x^2+1) )
  13. is used.The series is used to evaluate "artanh".
  14. ****************************************************************/
  15. #ifndef SN_H
  16. #include "sn.h"
  17. #endif
  18. SDouble Asinh(const SDouble& x){
  19. if(x.Sign(3310) == 0) return 0.0;
  20. SDouble r, y, one(1.0);
  21. if(x.NetRdxExp() < 0){ // |x| < 1/DRADIX
  22. r = x*RecSqrt(x*x+one); // r = x/sqrt(x*x+1)
  23. y = AtanhSeries(r); // Asinh(x) = Atanh( x/sqrt(x*x+1) )
  24. } else {
  25. r = Sqrt(x*x+one);
  26. if(x.Sign() > 0) r = r + x;
  27. else r = r - x;
  28. y = Log(r);
  29. if(x.Sign() < 0) y.ChangeSign(); // r = -r;
  30. }
  31. return y;
  32. }

sdfasinh.cpp : last modifiled at 2015/12/03 21:31:49(1,031 bytes)
created at 2017/10/07 10:22:50
The creation time of this html file is 2017/10/07 11:29:39 (Sat Oct 07 11:29:39 2017).